package com.iwhalecloud.bss.kite.cucc.client.api.shoppingcart.operate;

import com.iwhalecloud.bss.kite.cart.client.dto.req.DraftKiteCartReqDTO;
import com.iwhalecloud.bss.kite.client.dto.DataResult;
import com.iwhalecloud.bss.kite.client.dto.shoppingcart.ShoppingCartGroupInstDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.cart.CuccKiteCartDeleteRequestDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.cart.KiteCartAcceptReqDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.cart.KiteCartAcceptRspDTO;
import com.iwhalecloud.bss.kite.cucc.client.dto.cart.KiteCartRequestDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import com.ztesoft.bss.common.bo.SimpleLoginInfo;
import com.ztesoft.bss.rul.core.client.dto.common.RuleCommonParam;

/**
 * 购物车操作
 */
@Api(tags = "购物车操作")
public interface ICuccOperateShoppingCartService {



    /**
     * 保存购物车分组缓存-状态结算中-点保存购物车和去结算调用
     * @param sceneInstId
     * @param staffId
     * @param custId
     * @return
     */
    @ApiOperation(value = "保存购物车分组缓存-状态结算中-点保存购物车和去结算调用")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "sceneInstId", value = "场景实例", required = true),
        @ApiImplicitParam(name = "staffId", value = "员工ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "statusCd", value = "状态：1000录入中，1100结算中，1200收费中，1300已提交，1400退款中，1500退款完成", required = true),
        @ApiImplicitParam(name = "cartId", value = "购物车ID", required = true)
    })
    DataResult<Boolean> cacheShoppingCartGroup(SimpleLoginInfo simpleLoginInfo, String sceneInstId, String staffId,
        String custId, String statusCd, String cartId);

    /**
     * 清空购物车
     * @param staffId 员工id
     * @param custId 客户id
     * @return
     */
    @ApiOperation(value = "清空购物车")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "staffId", value = "员工id", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true)
    })
    DataResult<Boolean> clearShoppingCart(String staffId, String custId, RuleCommonParam ruleParam);


    /**
     * 去结算，购物车分组数据和购物项费用信息入库
     * @param sceneInstId
     * @param staffId
     * @param custId
     * @return
     */
    @ApiOperation(value = "去结算")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "sceneInstId", value = "场景实例", required = true),
        @ApiImplicitParam(name = "custOrderId", value = "订单实例", required = true),
        @ApiImplicitParam(name = "staffId", value = "员工ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "statusCd", value = "购物车分组状态", required = true)
    })
    DataResult<String> toSettle(SimpleLoginInfo simpleLoginInfo, String sceneInstId, String custOrderId, String staffId, String custId, String statusCd);

    /**
     * 去收费，修改购物车分组状态、过程实例入库
     * @param sceneInstId
     * @param staffId
     * @param custId
     * @return
     */
    @ApiOperation(value = "去收费")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "sceneInstId", value = "场景实例", required = true),
        @ApiImplicitParam(name = "custOrderId", value = "订单实例", required = true),
        @ApiImplicitParam(name = "staffId", value = "员工ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "statusCd", value = "购物车分组状态", required = true)
    })
    DataResult<Boolean> toCharge(SimpleLoginInfo simpleLoginInfo, String sceneInstId, String custOrderId, String staffId, String custId, String statusCd);


    /**
     * 删除购物车分组
     * @return
     */
    @ApiOperation(value = "删除购物车分组")

    DataResult<Boolean> deleteShoppingCartGroups(CuccKiteCartDeleteRequestDTO request);

    @ApiOperation(value = "删除购物车分组")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "groupId", value = "购物车分组ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "staffId", value = "工号ID", required = true),
        @ApiImplicitParam(name = "deleteGroupInst", value = "是否删除购物车分组", required = true)
    })
    void deleteShoppingCartGroupInfo(String groupId, String custId, String staffId, Boolean deleteGroupInst);

    @ApiOperation(value = "删除购物车分组")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "groupId", value = "购物车分组ID", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "staffId", value = "工号ID", required = true),
        @ApiImplicitParam(name = "deleteGroupInst", value = "是否删除购物车分组", required = true)
    })
    void deleteShoppingCartGroupInfo(String groupId, String custId, String staffId);

    @ApiOperation(value = "取消待生成订单的购物车分组")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "custOrderId", value = "客户订单id", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "staffId", value = "工号ID", required = true),
        @ApiImplicitParam(name = "orgId", value = "组织id", required = true),
        @ApiImplicitParam(name = "lanId", value = "本地网", required = true)
    })
    void cancelInvalidGroupInst(String custOrderId, String custId, String staffId, String orgId, String lanId);

    /**
     * 取消购物车分组，购物车信息和过程实例信息迁移到历史表，状态为无效
     * @param staffId 员工id
     * @param lanId 本地网
     * @param orgId 组织id
     * @param regionId 区域id
     * @param custId 客户id
     * @param groupId 取消的购物车分组标识
     * @param remark 备注
     * @return
     */
    @ApiOperation(value = "取消购物车分组")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "staffId", value = "员工id", required = true),
        @ApiImplicitParam(name = "lanId", value = "本地网", required = true),
        @ApiImplicitParam(name = "orgId", value = "组织id", required = true),
        @ApiImplicitParam(name = "regionId", value = "区域id", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "groupId", value = "客户id", required = true),
        @ApiImplicitParam(name = "remark", value = "备注", required = true)
    })
    DataResult<Boolean> cancelShoppingCartGroup(String staffId, String lanId, String orgId, String regionId,
        String custId, String groupId, String remark);


    @ApiOperation(value = "购物车数据归档")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "groupId", value = "分组id", required = true),
        @ApiImplicitParam(name = "custId", value = "客户ID", required = true),
        @ApiImplicitParam(name = "staffId", value = "员工id", required = true),
        @ApiImplicitParam(name = "orgId", value = "组织id", required = true),
        @ApiImplicitParam(name = "remark", value = "备注", required = true)
    })
    DataResult<Boolean> archiveShoppingCartData(String groupId, String custId, String staffId, String orgId, String remark);


    DataResult<ShoppingCartGroupInstDTO> createShoppingCartGroupInstInfo(KiteCartRequestDTO request);

    void archiveOrdInsts(String sceneInstId, String staffId, String orgId, String custId, String cartId);

    DataResult<KiteCartAcceptRspDTO> initCartGroupInstInfo(KiteCartAcceptReqDTO kiteCartAcceptReqDTO);


    /**
     * 清理购物车分组缓存
     */
    void clearShoppingCart();

    DataResult<String> draftKiteCart(DraftKiteCartReqDTO request);

    String getShoppingCartGroupInstStatusByCartId(String groupId, String custId, String cartId);
}
